package com.example.doer.reading;

import org.w3c.dom.Text;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by 严旭江 on 2017/7/11.
 */
//当一个类实现了Seializable接口
// （该接口仅为标记接口，不包含任何方法定义），表示该类可以序列化，
// 序列化的目的是将一个实现了Serializable接口的对象可以转换成一个字节序列，保存对象的状态
public class Topic implements Serializable {
    public static int i = 1;


    private int topicID;//话题的ID   主键
    private int userID;//话题--用户ID
    private String userName;//用户名
    private int resID;//用户头像的ID
    private String topicCatagory;//话题类别
    private String topicName;//话题名
    private String topicContent;//话题内容
    private int collectionCount;//收藏数目
    private int replyCount;//回复数目----------->算的评论与每个回复评论的数目
    private List<TopicReply>topicReply=new ArrayList<TopicReply>();//每个Topic对象对应一系列topicReply

    //应当属于TopicReply
    private int favoCount;//赞同数
    private int dislikeCount;//反对or没有帮助数目
    public Topic(){

    }
    //带参初始化构造函数
    public Topic (int theUserID,
                  String theUserName,
                  int theResID,//头像ID
                  String theCatagory,//话题类别
                  String theTopicName,
                  String theTopicContent)//------->一个回复该话题的内容
    {
        this.topicID= i++;
        this.userID = theUserID;
        this.userName=theUserName;
        this.topicCatagory = theCatagory;
        this.resID = theResID;
        this.topicName = theTopicName;
        this.topicContent = theTopicContent;
        this.favoCount = 0;this.dislikeCount = 0;this.collectionCount = 0;this.replyCount = 0;
    }

    //getter

    public int getTopicID() {
        return topicID;
    }
    public String getTopicCatagory(){return this.topicCatagory;}
    public int getUserID(){return this.userID;}
    public String getUserName(){return this.userName;}
    public String getTopicName(){return this.topicName;}
    public String getTopicContent(){return this.topicContent;}
    public int getResID(){return this.resID;}
    public int getFavoCount(){return this.favoCount;}
    public int getDislikeCount(){return this.dislikeCount;}
    public int getCollectionCount(){return this.collectionCount;}
    public int getReplyCount(){return this.replyCount;}
    public List<TopicReply> getTopicReply() {
        return this.topicReply;
    }

    //setter


    public void setTopicID(int topicID) {
        this.topicID = topicID;
    }
    public void setTopicContent(String theContent){
        this.topicContent = theContent;
    }
    public void setFavoCount(int theFavoCount){
        this.favoCount = theFavoCount;
    }
    public void setDislikeCount(int theDislikeCount){
        this.dislikeCount = theDislikeCount;
    }
    public void setCollectionCount(int theCollectionCount){
        this.collectionCount = theCollectionCount;
    }
    public void setReplyCount(int theReplyCount){this.replyCount= theReplyCount;}


}//end class
